﻿jQuery.fn.CatalogAction = function(defaultid, productid) {

var _this = jQuery("#industrylist");
    var pid1 = 0;
    var pid2 = 0;
    var _select1 = _this.find("select").eq(0);
    var _select2 = _this.find("select").eq(1);
    var _select3 = _this.find("select").eq(2);

    if (defaultid == null || defaultid == "") defaultid = 0;

    if (defaultid != 0) {
        pid1 = defaultid.split(',')[2];
        pid2 = defaultid.split(',')[1];
    }
    _select2.html("<option value=\"\">二级分类</option>");
    jQuery.get("ddddddd.aspx", { parentid: 0 },
        function(data) {
            _select1.html("");
            _select1.html("<option value=\"\">一级分类</option>" + data);
            _select2.html("");
            _select2.html("<option value=\"\">二级分类</option>");
            _select3.html("");
            _select3.html("<option value=\"\">三级分类</option>");
        });

        alert('ddd');
    _select1.change(function() {
        if (_select1.val() != "" && _select1.val() != null) pid1 = _select1.val();

        if (pid1 > 0) {
            jQuery.get("ddddddd.aspx", { parentid: pid1, defid: defaultid },
            function(data1) {
                _select2.html("");
                _select2.html("<option value=\"\">二级分类</option>" + data1);
                _select3.html("");
                _select3.html("<option value=\"\">三级分类</option>");
            });
        }
    }).change();



    _select2.change(function() {
        if (_select2.val() != "" && _select2.val() != null) pid2 = _select2.val();
        if (pid2 > 0) {
            jQuery.get("../Member/Corporation/industry_ajax.aspx", { parentid: pid2, defid: defaultid },
            function(data1) {
                _select3.html("");
                _select3.html("<option value=\"\">三级分类</option>" + data1);
            });
        }
    }).change();


    return _this;
}
